** 	Replication .do file for          **
** 	Shay & Rauhaus "Closing the Gap"  ** 	
**	Legislative Studies Quarterly	  **

* This code, if run properly, replicates Table 1*
* Please cite the above article if you use these data or code *
* All the analyses were done using Stata (Version 16).*

* Set working directory to load the data: Note that users will need to input the relevant file path
		cd /Users/user/Desktop/ 
		import delimited "Shay_and_Rauhaus_LSQ.csv"


******************************
*Main Text Analysis (Table 1)
******************************

*Declare Dataset and Panel ID
xtset fip year

*Model 1
xtpcse gap i.year pctwomenleg citizen_ideol govt_ideol unemployment poverty_rate gsp income evangle ig_women_pct statemin leg_prof, correlation(ar1)

*Figure 2
margins, at (pctwomenleg=(8 (2) 42)) atmeans
marginsplot, recast(line) recastci(rarea)

*Model 2
xtpcse gap i.year gop_women_leg dem_women_leg citizen_ideol govt_ideol unemployment poverty_rate gsp income evangle ig_women_pct statemin leg_prof, correlation(ar1)

*Model 3
xtpcse pctwomenearn i.year pctwomenleg citizen_ideol govt_ideol unemployment poverty_rate gsp income evangle ig_women_pct statemin leg_prof, correlation(ar1)

*Figure 3
margins, at (pctwomenleg=(8 (2) 42)) atmeans
marginsplot, recast(line) recastci(rarea)

*Model 4
xtpcse pctwomenearn i.year gop_women_leg dem_women_leg citizen_ideol govt_ideol unemployment poverty_rate gsp income evangle ig_women_pct statemin leg_prof, correlation(ar1)